<?php

namespace Worker\Controller;

use Common\Controller\BaseController;
use Worker\Logic;

class WorkerBaseController extends BaseController
{
    private $userInfo;

    public function _initialize()
    {
        parent::_initialize();
        $userLogic = new Logic\UserLogic();

        $userInfoRes = $userLogic->getUserInfo();
        if (!static::$res->isSuc($userInfoRes)) {
            //去到登陆页面
            redirect(C("WEB_DOMAIN") . "/Worker/Login/index");
            exit;
        }

        $userInfo = $userInfoRes['Result'];
        $this->setUserInfo($userInfo);
    }

    public function setUserInfo($userInfo)
    {
        $this->userInfo = $userInfo;
    }

    public function getUserInfo()
    {
        return $this->userInfo;
    }
}
